﻿using Microsoft.Extensions.Configuration;

namespace SlaughterItem.API.Filter
{
    public static class ServiceCollections
    {
        /// <summary>
        /// 配置管道
        /// </summary>
        /// <param name="builder"></param>
        /// <returns></returns>
        public static WebApplicationBuilder Inject(this WebApplicationBuilder builder)
        {
            builder.Host.ConfigureAppConfiguration((context, config) =>
            {
                config.SetBasePath(context.HostingEnvironment.ContentRootPath)
                .AddJsonFile("appsettings.json")
                .AddJsonFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.json", true, true)
                .AddEnvironmentVariables()
                .Build();

            });

            return builder;
        }
    }
}
